package com.mj.mes.rabbitMq;

import com.mj.mes.config.RabbitmqConfig;
import org.springframework.amqp.rabbit.core.RabbitMessagingTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by qzy on 2017/5/14.
 */
@Service
public class RabbitmqService {
    @Autowired
    private RabbitMessagingTemplate rabbitMessagingTemplate;

    public void sendContractRabbitmqTopic(Object object) {
        this.rabbitMessagingTemplate.convertAndSend(RabbitmqConfig.MJ_MES_EXCHANGE, RabbitmqConfig.ROUTING_KEY, object);
    }

    public void sendContractRabbitmqTopic(String routingKey, Object object) {
        this.rabbitMessagingTemplate.convertAndSend(RabbitmqConfig.MJ_MES_EXCHANGE, routingKey, object);
    }

    public void sendContractRabbitmqTopic(String exchange, String routingKey, Object object) {
        this.rabbitMessagingTemplate.convertAndSend(exchange, routingKey, object);
    }
}
